import config from '@/config'
import http from '@/utils/request'

export default {
	generateCode: {
		url: `${config.API_URL}/login/generateCode`,
		name: '获取验证码',
		post: async function (data = {}) {
			// eslint-disable-next-line no-return-await
			return await http.post(this.url, data, { responseType: 'arraybuffer' })
		}
	},
	token: {
		url: `${config.API_URL}/login/login`,
		name: '登录获取TOKEN',
		post: async function (data = {}) {
			// eslint-disable-next-line no-return-await
			return await http.post(this.url, data)
		}
	},
	home: {
		menu: {
			url: `${config.API_URL}/basic/home/menu`,
			name: '获取我的菜单',
			get: async function () {
				// eslint-disable-next-line no-return-await
				return await http.get(this.url)
			}
		},
		info: {
			url: `${config.API_URL}/basic/home/info`,
			name: '登录获取TOKEN',
			get: async function () {
				// eslint-disable-next-line no-return-await
				return await http.get(this.url)
			}
		}
	},

	app: {
		list: {
			url: `${config.API_URL}/user/app/list`,
			name: '应用列表',
			get: async function () {
				// eslint-disable-next-line no-return-await
				return await http.get(this.url)
			}
		},
		add: {
			url: `${config.API_URL}/user/app/add`,
			name: '新增列表',
			post: async function (params) {
				// eslint-disable-next-line no-return-await
				return await http.post(this.url, params)
			}
		},
		edit: {
			url: `${config.API_URL}/user/app/edit`,
			name: '编辑应用',
			post: async function (params) {
				// eslint-disable-next-line no-return-await
				return await http.post(this.url, params)
			}
		},
		genSecret: {
			url: `${config.API_URL}/user/app/genSecret`,
			name: '凭证',
			post: async function (params) {
				// eslint-disable-next-line no-return-await
				return await http.post(this.url, params)
			}
		},
		enable: {
			url: `${config.API_URL}/user/app/enable`,
			name: '启停',
			post: async function (params) {
				// eslint-disable-next-line no-return-await
				return await http.post(this.url, params)
			}
		}
	},

	org: {
		list: {
			url: `${config.API_URL}/org/list`,
			name: '获取组织树',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		add: {
			url: `${config.API_URL}/org/add`,
			name: '创建组织',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		edit: {
			url: `${config.API_URL}/org/edit`,
			name: '编辑组织',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		delete: {
			url: `${config.API_URL}/org/delete`,
			name: '删除组织',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		enable: {
			url: `${config.API_URL}/org/enable`,
			name: '启停组织',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		orgMappingDep: {
			url: `${config.API_URL}/org/orgMappingDep`,
			name: '部门映射组织',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		}
	},

	staff: {
		updatePwd: {
			url: `${config.API_URL}/basic/staff/updatePwd`,
			name: '获取用户列表',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		orgRoles: {
			url: `${config.API_URL}/basic/staff/orgRoles`,
			name: '获取用户列表',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		list: {
			url: `${config.API_URL}/basic/staff/list`,
			name: '获取用户列表',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		add: {
			url: `${config.API_URL}/basic/staff/add`,
			name: '新增用户',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		assignRole: {
			url: `${config.API_URL}/basic/staff/assignRole`,
			name: '分配角色',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		roleListById: {
			url: `${config.API_URL}/basic/staff/roleListById`,
			name: '通过用户ID获取角色',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		roleListByIds: {
			url: `${config.API_URL}/basic/staff/roleListByIds`,
			name: '通过多个用户ID获取角色',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		enable: {
			url: `${config.API_URL}/basic/staff/enable`,
			name: '更新用户状态',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		restPwd: {
			url: `${config.API_URL}/basic/staff/restPwd`,
			name: '密码重置',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		edit: {
			url: `${config.API_URL}/basic/staff/edit`,
			name: '更新用户信息',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		batchAuth: {
			url: `${config.API_URL}/basic/staff/batchAuth`,
			name: '批量分配角色',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		setPowerByStaff: {
			url: `${config.API_URL}/basic/staff/setPowerByStaff`,
			name: '通过账户设置权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		setDataPower: {
			url: `${config.API_URL}/basic/staff/setDataPower`,
			name: '通过账户设置数据权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		queryDataPower: {
			url: `${config.API_URL}/basic/staff/queryDataPower`,
			name: '通过账户查询数据权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		powerByStaffId: {
			url: `${config.API_URL}/basic/staff/powerByStaffId`,
			name: '通过账户查询菜单权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		queryDataPowerByMenu: {
			url: `${config.API_URL}/basic/staff/queryDataPowerByMenu`,
			name: '通过账户和菜单权限查询数据权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		setMenuDataPower: {
			url: `${config.API_URL}/basic/staff/setMenuDataPower`,
			name: '通过账户和菜单权限设置数据权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		//
		batchSetPowerByStaff: {
			url: `${config.API_URL}/basic/staff/batchSetPowerByStaff`,
			name: '通过账户批量设置菜单权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		batchSetMenuDataPower: {
			url: `${config.API_URL}/basic/staff/batchSetMenuDataPower`,
			name: '通过账户和菜单权限批量设置数据权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		batchSetDataPower: {
			url: `${config.API_URL}/basic/staff/batchSetDataPower`,
			name: '批量设置数据权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},

		deleteStaffDataPower: {
			url: `${config.API_URL}/basic/staff/deleteStaffDataPower`,
			name: '删除账户数据权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		deleteMenuStaffDataPower: {
			url: `${config.API_URL}/basic/staff/deleteMenuStaffDataPower`,
			name: '删除账户菜单数据权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		}
	},

	role: {
		list: {
			url: `${config.API_URL}/basic/role/list`,
			name: '根据部门id获取角色列表',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		add: {
			url: `${config.API_URL}/basic/role/add`,
			name: '新增角色',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		edit: {
			url: `${config.API_URL}/basic/role/edit`,
			name: '修改角色',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		delete: {
			url: `${config.API_URL}/basic/role/delete`,
			name: '删除角色',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		permission: {
			url: `${config.API_URL}/basic/role/setPower`,
			name: '设置角色权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		getPowerById: {
			url: `${config.API_URL}/basic/role/powerByRoleId`,
			name: '通过角色找到它的权限数据',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		getNumber: {
			url: `${config.API_URL}/basic/role/getNumber`,
			name: '获取编码',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		getPositionList: {
			url: `${config.API_URL}/basic/role/getPositionList`,
			name: '获取岗位信息',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		setPowers: {
			url: `${config.API_URL}/basic/role/setPowers`,
			name: '批量保存菜单权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		}
	},

	power: {
		add: {
			url: `${config.API_URL}/basic/power/add`,
			name: '新增权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		edit: {
			url: `${config.API_URL}/basic/power/edit`,
			name: '修改权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		list: {
			url: `${config.API_URL}/basic/power/list`,
			name: '权限列表',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		},
		delete: {
			url: `${config.API_URL}/basic/power/delete`,
			name: '批量删除权限',
			post: async function (params) {
				return await http.post(this.url, params)
			}
		}
		// permissions: {
		// 	url: `${config.API_URL}/basic/power/permissions`,
		// 	name: "获取编码权限",
		// 	post: async function (params) {
		// 		return await http.post(this.url, params);
		// 	}
		// },
	}
}
